package com.zlfund.cat.zjgsmk.controller;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.view.ViewGroup;

import com.zlfund.cat.zjgsmk.R;
import com.zlfund.cat.zjgsmk.bean.UserBean;
import com.zlfund.cat.zjgsmk.ui.user.LoginActivity;
import com.zlfund.cat.zjgsmk.util.BitmapHelper;

/**
 * Created by chenj on 2017/9/21 0021.
 */

public class NoLoginHelper extends LoginStateImp {
    @Override
    public void showSquareUI(ViewGroup rootView) {
        super.showSquareUI(rootView);
        mLlFocusLlyt.setVisibility(View.GONE);
    }

    @Override
    public void showSettingUI(ViewGroup rootView) {
        super.showSettingUI(rootView);
        final Context context = rootView.getContext();
        mLlLoginShow.setVisibility(View.GONE);
        mTvLogin.setText("点击登录");
        mLlytLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, LoginActivity.class));
            }
        });
    }

    @Override
    public void showUserUi(final ViewGroup rootView, UserBean userBean) {
        super.showUserUi(rootView,userBean);
        final Context context = rootView.getContext();
        Bitmap bm = BitmapFactory.decodeResource(rootView.getResources(), R.mipmap.bjt);
        mHeadView.setBlurBm(bm);
        mIvUserIcon.setImageBitmap(BitmapHelper.cropCircleImage(bm));
        mTvName.setText("未登录");
        mTvDesc.setVisibility(View.GONE);
        mTvFans.setVisibility(View.GONE);
        mTvFocus.setVisibility(View.GONE);
    }
}
